module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    
    shell: {
      server: {
        command: 'dev_appserver.py .'
      },
      deploy: {
        command: 'appcfg.py -A ordinal-crowbar-686 --oauth2 update .'
      }
    },

    compass: {
      dev: {
        options: {
          sassDir: 'scss',
          cssDir: 'static/css',
          environment: 'development',
          outputStyle: 'expanded'
        }
      },
      dist: {
        options: {
          sassDir: 'scss',
          cssDir: 'static/css',
          environment: 'production',
          outputStyle: 'compressed'
        }
      }
    },

    watch: {
      css: {
        files: 'scss/**/*.scss',
        tasks: ['compass:dev'],
        options: {
          livereload: true
        }
      }
    },

    concurrent: {
      dev: ['shell:server', 'watch:css'],
      options: {
        logConcurrentOutput:true
      }
    },

    useminPrepare: {
      html: 'templates/index.html'
    },

    usemin: {
      html: 'templates/index.html'
    }


  });

  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task(s).
  grunt.registerTask('default', ['concurrent:dev']);
  grunt.registerTask('build', ['useminPrepare', 'concat:generated', 'compass:dist', 'uglify:generated', 'shell:deploy'])

};